import React, { useState } from 'react';
import { Form, Input, Select, Button, Radio, Row, Col, Checkbox, DatePicker, Modal, Space } from 'antd';
const { Option } = Select;

const { RangePicker } = DatePicker;

const PriceInput = ({ value = {}, onChange }) => {
    const [number, setNumber] = useState(0);
    const [currency, setCurrency] = useState('rmb');
    const [tagConditionType, setTagConditionType] = useState(1);
    const [totalConsumeNum, setTotalConsumeNum] = useState(0);
    const [totalConsumeMoney, setTotalConsumeMoney] = useState(0);
    //消费时间
    const [consumeTime, setConsumeTime] = useState(false);
    //历史累计消费次数
    const [checkTotalConsumeNum, setCheckTotalConsumeNum] = useState(false);


    const triggerChange = (changedValue) => {
        onChange?.({
            number,
            currency,
            ...value,
            ...changedValue,
        });
    };

    const onTagConditionTypeChange = e => {
        setTagConditionType(e.target.value);
        triggerChange({
            tagConditionType: e.target.value
        })
    }

    return (
        <span>
            <Row gutter={[16, 24]}>
                <Col span={24}>
                    <Radio.Group
                        onChange={onTagConditionTypeChange}
                        value={value.tagConditionType || tagConditionType}
                        style={{ marginTop: 5 }}>
                        <Space direction="vertical">
                            <Radio value={1}>
                                <Space wrap>
                                    <RangePicker />
                                
                                </Space>
                                <p>
                                    hello
                                </p>
                            </Radio>
                            <Radio value={2}>
                                <Space>
                                    <span>
                                        领取当日起
                                    </span>
                                    <Input placeholder="Basic usage" />
                                    <span>
                                        可用
                                    </span>
                                </Space>

                            </Radio>
                        </Space>
                    </Radio.Group>
                </Col>
            </Row>
        </span>
    );
};

export default PriceInput;